/*
 * @Author: 噜噜雯雯 2199987619@qq.com
 * @Date: 2025-05-28 11:29:08
 * @LastEditors: 噜噜雯雯 2199987619@qq.com
 * @LastEditTime: 2025-09-26 15:46:46
 * @FilePath: \linePatrol\vue-element-plus-admin\src\api\linePatrol\index.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import service from '@/axios/http'
import { TableIResponse } from '@/utils/Api'
import { PatrolInfoDetail, PatrolInspectionType, PatrolPlanListType, PatrolInfList } from './type'
export class PatrolInfoApi {
  //获取巡检轨迹列表
  async PatrolInfolist(params: PatrolInfList): Promise<TableIResponse<PatrolInfList[]>> {
    const result = (await service.get('/api/patrol/patrolInfo/list', { params })) as unknown as any
    return result
  }
  //获取巡检轨迹详情
  async PatrolInfoDetail(uuid: string | undefined): Promise<PatrolInfoDetail> {
    const result = (await service.get(`/api/patrol/patrolInfo/${uuid}`)) as unknown as any
    const { data } = result
    return data
  }
  //删除巡检轨迹列表
  async DeletpatrolInfo(uuid: string): Promise<boolean> {
    const result = (await service.delete(`/api/patrol/patrolInfo/${uuid}`)) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
  //获取巡检任务
  async PatrolplanList(params: PatrolPlanListType): Promise<TableIResponse<PatrolPlanListType[]>> {
    const result = (await service.get('/api/patrol/planList/list', { params })) as unknown as any
    return result
  }
  //获取巡检点管理
  async PatrolInspection(
    params: PatrolInspectionType
  ): Promise<TableIResponse<PatrolInspectionType[]>> {
    const result = (await service.get('/api/patrol/patrolInspection/list', {
      params
    })) as unknown as any
    return result
  }
  //删除巡检任务
  async DeletPatrolplan(uuid: string): Promise<boolean> {
    const result = (await service.delete(`/api/patrol/planList/${uuid}`)) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
}
export default new PatrolInfoApi()
